<%@ page language="java" contentType="text/html; charset=utf-8"
         pageEncoding="utf-8" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用户登录</title>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
    <%
        String path = request.getContextPath();
        String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
                + path;
    %>
    <c:set var="bp" value="<%=basePath%>"></c:set>
    <link rel="stylesheet" type="text/css" href="${bp}/static/css/htmleaf-demo.css"/>
    <link rel="stylesheet" type="text/css" href="${bp}/static/css/normalize.css"/>
    <link rel="stylesheet" type="text/css" href="${bp}/static/css/login.css"/>
    <script type="text/javascript" src="${bp}/static/js/jquery.js"></script>
    <script type="text/javascript" src="${bp}/static/js/login.js"></script>
    <script>
        //是否存在已注册的电话
        function rrregist() {
            //判断手机号是否已经注册
            var phone1 = $.trim($('#utel').val());
            console.log(phone1);
            $.ajax({
                url: "getcustomerbyutel.action",
                type: "post",
                data: {
                    "utel": phone1,
                },
                success: function (result) {
                    var re1 = JSON.parse(result);
                    console.log(re1);
                    if (re1==false){
                        $("#uteltishi").html("未注册，请去注册");
                        document.getElementById("uteltishi").style.color = "red";
                        $("#utel").val("")
                    }else{
                        $("#uteltishi").html("用户已经存在，请输入密码");
                        document.getElementById("uteltishi").style.color = "#999999";
                    }
                }
            });
        }
        // 得到焦点，提示归零
        function uTel_check2() {
            $("#uteltishi").html("");
        }
        //查看确认密码
        function openrepass(){
            var repassshow=document.getElementById("upass");
            if (repassshow.type=="password"){
                repassshow.type="text";
            }else{
                repassshow.type="password";
            }
        }
    </script>
</head>

<body>
    <div class="htmleaf-container">
        <div id="wrapper" class="login-page">
            <div id="login_form" class="form">
                <form class="login-form" action="login" method="post">
                    <h3 style="text-align: center;margin-top:0">用户登录</h3>
                    <input type="text" placeholder="您的电话号码" id="utel" name="utel" required="required" onblur="rrregist()" onfocus="uTel_check2()"/>
                    <p id="uteltishi"></p>
                    <div> <input type="password" placeholder="密码" id="upass" name="upass" required="required" onclick="rrregist()"/>
                    <span onclick="openrepass()" style="color: #5a5745; position: absolute;margin:16px 0 0 -40px;font-size: 10px; ">查看</span></div>
                    <input style="background-color: #5cb85c" value="登	录"  type="submit">
                    <p class="message">还没有账户? <a id="toregist" href="toregist">立刻创建</a></p>
                </form>
            </div>
        </div>
    </div>
</body>
</html>